package collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.Random;

public class Test2 {
    public static void main(String[] args) {
        Random r = new Random();
        Collection<Integer> c = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            c.add(r.nextInt(100));
        }
        System.out.println(c);

        Iterator<Integer> it = c.iterator();
        while (it.hasNext()) {
            int i = it.next();//(it.next()).intValue();自动拆箱
            if (i % 2 == 0) {
                it.remove();
            }

        }
        System.out.println(c);
    }
}
